<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%> 
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>海淘镖局-速递公司-注册页面</title>
<link href="css/cs.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="ext-2.2/adapter/ext/ext-base.js"></script>
	<script type="text/javascript" src="ext-2.2/ext-all.js"></script>
<script src="js/DD_belatedPNG_0.0.8a.js" type="text/javascript"></script>
    <script type="text/javascript">
        DD_belatedPNG.fix('div, ul, img, li, input , png , a');
    </script>
	<script language="javascript" type="text/javascript">
function Show_zllMenu(tabadid_num,tabadnum){
	for(var i=0;i<4;i++){document.getElementById("tabadcontent_"+tabadid_num+i).style.display="none";}
	for(var i=0;i<4;i++){document.getElementById("tabadmenu_"+tabadid_num+i).className="";}
	document.getElementById("tabadmenu_"+tabadid_num+tabadnum).className="nz0";
	document.getElementById("tabadcontent_"+tabadid_num+tabadnum).style.display="block";
}
</script>
    <script type="text/javascript">

function checkPhone( strPhone ) { 
var phoneRegWithArea = /^[0][1-9]{2,3}-[0-9]{5,8}$/; 
var phoneRegNoArea = /^[1-9]{1}[0-9]{5,8}$/; 
if( strPhone.length > 9 ) {
    if( phoneRegWithArea.test(strPhone) ){return true; }else{return false;}
}else{
    if(phoneRegNoArea.test(strPhone)){return true; }else{return false;}
}
}

function checkMobile( s ){ 
//var regu =/^[1][3,8][0-9]{9}$/; 
var regu =/^1\d{10}$/;
var re = new RegExp(regu); 
if (re.test(s)) { 
return true; 
}else{ 
return false; 
} 
} 


    function checkPhoneAndMobile(phone)   
{    
if (checkMobile(phone) || checkPhone(phone)){ 
return true;   
}
return false;  
}
    
    
    function isEmail(str){
    	var myReg = /^[-_.A-Za-z0-9]+@([_A-Za-z0-9]+\.)+[A-Za-z0-9]{2,3}$/; 
        if(myReg.test(str)) return true; 
    	return false; 
    }
 
	function checkRegister(){
    		var Uname = document.getElementById("Uname").value;
    		var patterns =/^[a-zA-Z\s]+$/;
    		if(Uname==""){
    			alert("请填写姓名");
    			return;
    		}
   			if(!Uname.match(patterns)) 
				{ 
					alert("姓名只能是拼音!"); 
					return;
				} 
    	
					
    		var Utelephone = document.getElementById("Utelephone").value;
    		if(Utelephone==""){
    			alert("请填写联系电话");
    			return;
    		}
    		if(!checkPhoneAndMobile(Utelephone)){
    			alert("请输入正确的联系号码！");
    			return;
    		}
    			var email = document.getElementById("UemailId").value;
    		if(email==""){
    			alert("请填写邮箱!");
    			return;
    		}
    		  
    		if(!isEmail(email))
    		{
    			alert("请填写正确的邮件格式");
    			return;
    		}
    		if(document.getElementById("UpasswordId").value==""){
    			alert("请填写密码!");
    			return;
    		}
    		if(document.getElementById("UpasswordId").value!=document.getElementById("Upassword1").value){
    			alert("两次密码不一致");
    			return;
    		}
    		 Ext.Ajax.request({ 
                      //请求地址 
                      url: 'user!checkEmailExist.do', 
                      //提交参数组 
                      params: { 
                          Uemail : Ext.get('UemailId').dom.value 
                      }, 
                      //成功时回调 
                      success: function(response, options) { 
                         //获取响应的json字符串 
                        var responseArray = Ext.util.JSON.decode(response.responseText);                                               
                             if(responseArray.success==true){ 
                                var form = document.forms["registerForm"];
    							form.action = "user!register.do";
    							form.submit();  
                             } 
                             else{ 
                                alert('该邮件已经被注册过！');      
                             } 
                     } 
             }); 
    	}

	function clearContent()
	{
		document.getElementById("Uname").value = "";
		document.getElementById("Utelephone").value = "";
		document.getElementById("UpasswordId").value = "";
		document.getElementById("Upassword1").value = "";
		document.getElementById("UemailId").value = "";
		
	}
	
 
    </script>
</head>
<%
java.lang.String recommendId = request.getParameter("f");
session.setAttribute("recommendId", recommendId);
%>
<body>
<div id="dh">
<jsp:include page="menu_new.jsp" flush="true"/>
</div>
<div id="zc_1">
<div id="zc_1_nr">
<div id="zc_1_1"></div>
<div id="zc_1_2">
<form method="post" name="registerForm" action="">
<table width="735" border="0" cellspacing="15" cellpadding="15" align="center" style="margin-top:40px;">
  <tr>
    <td width="100" style="text-align:right;">用户名：</td>
    <td width="230"><input name="Uname" id="Uname" type="text" style="width:210px; height:22px; line-height:22px;" /></td>
    <td style="font-size:13px;"><span class="hongse">*</span>&nbsp;姓名只能是拼音</td>
  </tr>
   <tr>
    <td width="100" style="text-align:right;">邮箱：</td>
    <td width="230"><input id="UemailId" name="Uemail" type="text" style="width:210px; height:22px; line-height:22px; " /></td>
    <td style="font-size:13px;"><span class="hongse">*</span>&nbsp;邮箱是注册后的登录名，每个邮箱只能注册一次</td>
  </tr>
  <tr>
    <td width="100" style="text-align:right;">设置密码：</td>
    <td width="230"><input type="password" name="Upassword" id="UpasswordId"  style="width:210px; height:22px; line-height:22px; "/></td>
    <td style="font-size:13px;"><span class="hongse">*</span>&nbsp;至少六个字符不能为纯数字</td>
  </tr>
  <tr>
    <td width="100" style="text-align:right;">确认密码：</td>
    <td width="230"><input type="password" name="Upassword1" id="Upassword1" type="text" style="width:210px; height:22px; line-height:22px; " /></td>
    <td style="font-size:13px;"><span class="hongse">*</span>&nbsp;请再次输入密码</td>
  </tr>
  <tr>
    <td width="100" style="text-align:right;">联系电话：</td>
    <td width="230"><input  id="Utelephone" name="Utelephone"  type="text" style="width:210px; height:22px; line-height:22px; "  /></td>
    <td style="font-size:13px;"><span class="hongse">*</span>&nbsp;联系电话格式可以是11位手机号码（13788888888）或者座机，例如（021-58585858）</td>
  </tr>
</table>
</div>
<div id="zc_1_3">
<table width="700" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
   <td width="100"></td>
    <td width="150"><input name="" type="button" onclick="checkRegister()" style="width:97px; height:36px; background:url(images/zc_ljzc.gif) no-repeat; border:0; " /></td>
    <td width="400"><input name="" type="button" onclick="clearContent()" style="width:97px; height:36px; background:url(images/zc_cxsz.gif) no-repeat; border:0; " /></td>
  </tr>
</table>
</form>
</div>
<div id="zc_1_4"></div>
<div id="zc_1_5"></div>
<div id="zc_1_6">
<jsp:include page="foot.jsp"/>
</div>
</div>
</div>
</body>
</html>
